//
//  PBAdsCell.m
//  PBHomeDemo
//
//  Created by Playboy on 2017/11/21.
//  Copyright © 2017年 tmkj. All rights reserved.
//

#import "PBAdsCell.h"
#import "SXScrPageView.h"
#import "PBZoomRotationView.h"
#import "PBServeBannerModel.h"
#import "PBHomeModel.h"
#import "PBAdsDetailController.h"

@interface PBAdsCell()

@property (strong, nonatomic) SXScrPageView *pageView;
@property (nonatomic, strong) PBZoomRotationView *zoomView;

@end

@implementation PBAdsCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    [self configure];
}

- (void)configure {
    [self configureView];
    [self configureData];
}

- (void)configureView {
    
}
- (void)configureData {
    
}

// 首页广告位
- (void)refreshWithArray:(NSMutableArray *)array {
    
    
//    [self.zoomView removeFromSuperview];
//    self.zoomView = [PBZoomRotationView direcWithtFrame:CGRectMake(0, 5, kScreenWidth, 190) ImageArr:[array copy] AndImageClickBlock:^(NSInteger index) {
//
//    }];
//    [self.contentView addSubview:self.zoomView];
    
    NSMutableArray *ads = [[NSMutableArray alloc] init];
    for (PBHomeModel *model in array) {
        [ads addObject:model.url];
    }
    [self.pageView removeFromSuperview];
    self.pageView = [SXScrPageView direcWithtFrame:CGRectMake(0, 0, kScreenWidth, 190) ImageArr:ads AndImageClickBlock:^(NSInteger index) {
        // 暂时不需要跳转
//        NSLog(@"%zd",index);
//        PBHomeModel *home = array[index];
//        PBAdsDetailController *vc = [[PBAdsDetailController alloc] init];
//        vc.hidesBottomBarWhenPushed = YES;
//        vc.url = home.bizContent;
//        [self.jumpVC.navigationController pushViewController:vc animated:YES];
    }];
    [self.contentView addSubview:self.pageView];
    
    
}

// 生活服务
- (void)refreshServeListWithArray:(NSArray *)array {
    
    NSMutableArray *ads = [[NSMutableArray alloc] init];
    for (PBServeBannerModel *model in array) {
        [ads addObject:model.url];
    }
    [self.pageView removeFromSuperview];
    self.pageView = [SXScrPageView direcWithtFrame:CGRectMake(0, 0, kScreenWidth, 190) ImageArr:ads AndImageClickBlock:^(NSInteger index) {
        
    }];
    [self.contentView addSubview:self.pageView];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
